package com.humble.humbleojjudgeservice.judge;/*
  humble keep gonging
*/


import com.humble.humbleojjudgeservice.judge.strategy.JudgeStrategy;
import com.humble.humbleojjudgeservice.judge.strategy.JudgeStrategyFactory;
import com.humble.humbleojmodel.model.enums.QuestionSubmitLanguageEnum;
import com.humble.humbleojmodel.model.judge.JudgeContext;
import com.humble.humbleojmodel.model.judge.JudgeResult;
import org.springframework.stereotype.Service;

/**
 * 具体选择哪种策略由该类进行判断
 */
@Service
public class JudgeManager {
    public JudgeResult useJudgeStrategy(JudgeContext judgeContext) {
        String strategyType="";
        if(judgeContext.getLanguage().equals(QuestionSubmitLanguageEnum.PYTHON.getValue())){
            strategyType = "python";
        }
        JudgeStrategy strategy = JudgeStrategyFactory.getInstance(strategyType);
        return strategy.doJudge(judgeContext);
    }
}
